package com.net.xpay.core.domain;

import com.net.xpay.common.domain.User;
import com.net.common.domain.CommonDomain;
import com.net.xpay.core.enums.TaokeStatus;
import com.net.xpay.core.model.TaokeDetectionModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
 * 2020/6/6 10:17

 * 淘客检测记录
 */
@Getter
@Setter
@NoArgsConstructor
public class TaokeDetectionRecord extends CommonDomain {
    @ApiModelProperty(notes = "商户编号")
    private Long userId;

    @ApiModelProperty(notes = "批次id")
    private Long batchId;

    @ApiModelProperty(notes = "批次号")
    private String batchNo;

    @ApiModelProperty(notes = "外部批次号")
    private String outBatchNo;

    @ApiModelProperty(notes = "旺旺")
    private String ww;

    @ApiModelProperty(notes = "订单号")
    private String tid;

    @ApiModelProperty(notes = "买家手机号")
    private String buyerMobile;

    @ApiModelProperty(notes = "-2检测失败 -1 待检测  0.非淘客  1.淘客")
    private TaokeStatus status;

    @ApiModelProperty(notes = "检测失败原因")
    private String errorMessage;

    public static TaokeDetectionRecord getInstance() {
        return new TaokeDetectionRecord();
    }

    public static TaokeDetectionRecord getInstance(User user, TaokeDetectionModel detectionModel) {
        TaokeDetectionRecord instance = new TaokeDetectionRecord();
        instance.setUserId(user.getId());
        instance.setWw(detectionModel.getWw());
        instance.setTid(detectionModel.getTid());
        instance.setBuyerMobile(detectionModel.getBuyerMobile());
        instance.setStatus(TaokeStatus.WAIT);

        return instance;
    }
}
